package cn.lg.soar.system.feign;


import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.system.api.constant.ModuleConst;
import cn.lg.soar.system.api.model.*;
import cn.lg.soar.system.api.service.IUserApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ConditionalOnMissingClass("cn.lg.soar.system.auth.client.UserApiClient")
@ApiClient
@FeignClient(
        name= ModuleConst.MODULE_NAME,
        path= ModuleConst.CLIENT_PATH + "/user",
        contextId="UserApiFeign"
)
public interface UserApiFeign extends IUserApi {

    @GetMapping("listByIds")
    @Override
    List<UserQueryDTO> listByIds(@RequestParam("ids") List<Long> ids);

    @GetMapping("getById")
    @Override
    UserQueryDTO getById(@RequestParam("userId") Long userId);

    @GetMapping("getByAccount")
    @Override
    UserQueryDTO getByAccount(@RequestParam("accountType") Integer accountType, @RequestParam("account") String account);

    @PostMapping("create")
    @Override
    Long create(@RequestBody UserCreateDTO dto);

    @PostMapping("update")
    @Override
    void update(@RequestBody UserUpdateDTO dto);

    @PostMapping("binding")
    @Override
    void binding(@RequestBody UserBindDTO dto);

    @GetMapping("getUserCurrentAllRoleIds")
    @Override
    List<Long> getUserCurrentAllRoleIds(@RequestParam("userId") Long userId);

    @GetMapping("isSuperAdministrator/username")
    @Override
    boolean isSuperAdministrator(@RequestParam("username") String username);

    @GetMapping("isSuperAdministrator/userId")
    @Override
    boolean isSuperAdministrator(@RequestParam("userId") Long userId);

    @GetMapping("userAccountList")
    @Override
    List<AuthAccountBind> userAccountList(@RequestParam("userId") Long userId);

}
